package org.zoomdev.zoom.aop.utils;

import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

public class AnonymousMethodVisitor extends MethodVisitor {
    public AnonymousMethodVisitor(int api, MethodVisitor mv) {
        super(api, mv);
    }

    @Override
    public void visitCode() {
        System.out.println("方法字节码开始");
        super.visitCode();
    }

    @Override
    public void visitInsn(int opcode) {
        System.out.println("指令: " + opcode);
        super.visitInsn(opcode);
    }

    @Override
    public void visitFieldInsn(int opcode, String owner, String name, String descriptor) {
        System.out.printf("字段访问: %s.%s %s\n", owner, name, descriptor);
        super.visitFieldInsn(opcode, owner, name, descriptor);
    }
}